<div>
    <h2 id="page-heading">
        <span>Relationships</span>
        <button id="jh-create-entity" class="btn btn-primary float-right jh-create-entity create-relationship" [routerLink]="['/relationship/new']">
            <fa-icon [icon]="'plus'"></fa-icon>
            <span >
            Create new Relationship
            </span>
        </button>
    </h2>
    <jhi-alert></jhi-alert>
    <br/>
    <div class="table-responsive" *ngIf="relationships">
        <table class="table table-striped">
            <thead>
            <tr jhiSort [(predicate)]="predicate" [(ascending)]="reverse" [callback]="transition.bind(this)">
            <th jhiSortBy="id"><span>ID</span> <fa-icon [icon]="'sort'"></fa-icon></th>
            <th jhiSortBy="mainUserOpenId"><span>Main User Open Id</span> <fa-icon [icon]="'sort'"></fa-icon></th>
            <th jhiSortBy="secondUserOpenId"><span>Second User Open Id</span> <fa-icon [icon]="'sort'"></fa-icon></th>
            <th jhiSortBy="relation"><span>Relation</span> <fa-icon [icon]="'sort'"></fa-icon></th>
            <th jhiSortBy="distanceSize"><span>Distance Size</span> <fa-icon [icon]="'sort'"></fa-icon></th>
            <th></th>
            </tr>
            </thead>
            <tbody>
            <tr *ngFor="let relationship of relationships ;trackBy: trackId">
                <td><a [routerLink]="['/relationship', relationship.id, 'view' ]">{{relationship.id}}</a></td>
                <td>{{relationship.mainUserOpenId}}</td>
                <td>{{relationship.secondUserOpenId}}</td>
                <td>{{relationship.relation}}</td>
                <td>{{relationship.distanceSize}}</td>
                <td class="text-right">
                    <div class="btn-group flex-btn-group-container">
                        <button type="submit"
                                [routerLink]="['/relationship', relationship.id, 'view' ]"
                                class="btn btn-info btn-sm">
                            <fa-icon [icon]="'eye'"></fa-icon>
                            <span class="d-none d-md-inline">View</span>
                        </button>
                        <button type="submit"
                                [routerLink]="['/relationship', relationship.id, 'edit']"
                                class="btn btn-primary btn-sm">
                            <fa-icon [icon]="'pencil-alt'"></fa-icon>
                            <span class="d-none d-md-inline">Edit</span>
                        </button>
                        <button type="submit"
                                [routerLink]="['/', 'relationship', { outlets: { popup: relationship.id + '/delete'} }]"
                                replaceUrl="true"
                                queryParamsHandling="merge"
                                class="btn btn-danger btn-sm">
                            <fa-icon [icon]="'times'"></fa-icon>
                            <span class="d-none d-md-inline">Delete</span>
                        </button>
                    </div>
                </td>
            </tr>
            </tbody>
        </table>
    </div>
    <div *ngIf="relationships && relationships.length">
        <div class="row justify-content-center">
            <jhi-item-count [page]="page" [total]="totalItems" [maxSize]="5" [itemsPerPage]="itemsPerPage"></jhi-item-count>
        </div>
        <div class="row justify-content-center">
            <ngb-pagination [collectionSize]="totalItems" [(page)]="page" [pageSize]="itemsPerPage" [maxSize]="5" [rotate]="true" [boundaryLinks]="true" (pageChange)="loadPage(page)"></ngb-pagination>
        </div>
    </div>
</div>
